package com.xuecheng.system.convent;

import com.xuecheng.api.system.model.dto.CourseCategoryDTO;
import com.xuecheng.system.entity.ext.CourseCategoryNode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface CourseCategoryConvert {

    CourseCategoryConvert INSTANCE = Mappers.getMapper(CourseCategoryConvert.class);
    @Mappings({
            @Mapping(source = "id",target = "courseCategoryId"),
            @Mapping(source = "childrenTreeNodes",target = "categoryTreeNodes")
    })
    CourseCategoryDTO entity2dto(CourseCategoryNode courseCategory);

    /**
     * todo 将pos转成DTOs
     * @param courseCategoryList
     * @return
     */
    List<CourseCategoryDTO> entitys2dtos(List<CourseCategoryNode> courseCategoryList);


}
